import { defineStore } from 'pinia'

export const useCanvasStore = defineStore({
  id: 'isCanvas',
  state: () => ({
    isCanvas: false
  }),
  getters: {
    getValue: (state) => state.isCanvas
  },
  actions: {
    setValue(value) {
      if (value) {
        this.isCanvas = value
      } else {
        this.isCanvas = !this.isCanvas
      }
    }
  }
})

export const currentYBD = defineStore({
  id: 'ybd',
  state: () => ({
    ybd: '0'
  }),
  getters: {
    getValue: (state) => state.ybd
  },
  actions: {
    setValue(value) {
      this.ybd = value
    }
  }
})

export const userInfo = defineStore({
  id: 'userInfo',
  state: () => ({
    userInfo: {}
  }),
  getters: {
    getValue: (state) => state.userInfo
  },
  actions: {
    setValue(value) {
      this.userInfo = value
    }
  }
})

export const useActiveIndex = defineStore({
  id: 'activeIndex',
  state: () => ({
    activeIndex: 'routineFore'
  }),
  getters: {
    getValue: (state) => state.activeIndex
  },
  actions: {
    setValue(value) {
      this.activeIndex = value
    }
  }
})

export const useIfwindParticle = defineStore({
  id: 'bool',
  state: () => ({ bool: true }),
  getters: { getValue: (state) => state.bool },
  actions: {
    setValue(value) { this.bool = value }
  }
})

// 全局时间
export const useGlobalTime = defineStore({
  id: 'globalTime',
  state: () => ({ globalTime: '' }),
  getters: { value: (state) => state.globalTime },
  actions: {
    setValue(value) { this.globalTime = value }
  }
})